Repository navigation
feat(fs): rename files and directories - #175
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of one type in order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename takes the stripes of every directory whose entries change, the volume lock when a directory changes parent, and the inode locks in lock-record order. Under them it rechecks both names, the types, an emptied target and the move-into-itself case. It runs the caller's commit, then writes both parent inodes before any chunk. A directory that changes parent gets its ".." rewritten and both link counts adjusted. A full new parent grows by an empty block first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DirRename now carries both parents' generations, the moved inode's generation and type, and the replaced target, so replay finishes a committed rename: the new name ends up naming the moved inode, the old name goes, a moved directory's ".." follows, and each parent's link count changes only while the parent is as the rename logged it. If another node took the new name since, the old name stays and the target's own records in the transaction leave it alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename and RENAME_NOREPLACE now work within a directory and between directories; RENAME_EXCHANGE and RENAME_WHITEOUT give EINVAL. A replaced file loses its link through the same path unlink uses, so a peer that has it open keeps it until its last close; a replaced empty directory is freed. The journal records the rename and what it does to the target before anything changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each of five renames, in one directory, between directories, over a file, a directory moving between parents, and a directory over an empty one, ends with exactly one of its two names after replay, and fsck finds nothing but leaks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nged its names renameOnce releases its locks before it completes its intent, so a later rename, rename back or unlink could change the names before a crash, and replay then redid the rename over them: two names for one link, a name for a freed inode, or a rename undone. A rename writes each parent, and a moved directory, once under its locks, so replay now skips the names when any of them is freed or more than one write past the generation the rename logged. The CHANGELOG notes that older nodes replaying this journal skip the rename but drop the target's link, so every node must be upgraded before anyone renames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No node holds a symlink open, so listing it as an orphan only delays its free until peers let go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each uses its own image and its own closures, and the hooks they could touch are only set by sequential tests, which Go runs first. Under -race with coverage on .68 their wall time fell from 184 s to 91 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox
added a commit
that referenced
this pull request
Nov 16, 2026
internal/goclusterfs alone took 407 s of group 1's 8 min, and #175 adds about 85 s. unit-groups.sh now gives a package with a shard count in unit-timings.txt that many groups of its own, split by test name and balanced with unit-test-timings.txt; the other packages share the rest. CI runs 4 groups: goclusterfs in two halves of about 259 s of test time each, fsck (197 s), and everything else (190 s). make test-unit takes the -run regex from UNIT_RUN in the environment. A split package shows up in two cover profiles, so the coverage summary now merges blocks (covered if either profile ran them) and builds the per-package table from the merged profile instead of go test's lines. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rename PR 1 of 3 from the approved plan: the core. PR 2 adds fsck checks (one name per directory, "..", cycles). PR 3 adds multi-node, Docker and VM tests, renames in the history checker, and the soak model.
What the code can't tell you:
lock.Record). The volume lock stops two concurrent moves that each pass the ancestor check from forming a cycle.RENAME_EXCHANGEandRENAME_WHITEOUTgive EINVAL.Evidence on .68, on main 580d18f plus #174: lint, unit,
-race,-shortintegration (150 pass, 0 fail), parity,-raceon dir and journal. Power cuts at every write of five renames (6 to 15 writes each) end with exactly one name, and fsck finds only leaks.TestRenameruns through the mount.The first commit fixes the two wording nits from #174's review.
🤖 Generated with Claude Code